{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1]\tvalid_0's multi_logloss: 1.02277\n",
      "Training until validation scores don't improve for 5 rounds\n",
      "[2]\tvalid_0's multi_logloss: 0.943765\n",
      "[3]\tvalid_0's multi_logloss: 0.873274\n",
      "[4]\tvalid_0's multi_logloss: 0.810478\n",
      "[5]\tvalid_0's multi_logloss: 0.752973\n",
      "[6]\tvalid_0's multi_logloss: 0.701621\n",
      "[7]\tvalid_0's multi_logloss: 0.654982\n",
      "[8]\tvalid_0's multi_logloss: 0.611268\n",
      "[9]\tvalid_0's multi_logloss: 0.572202\n",
      "[10]\tvalid_0's multi_logloss: 0.53541\n",
      "[11]\tvalid_0's multi_logloss: 0.502582\n",
      "[12]\tvalid_0's multi_logloss: 0.472856\n",
      "[13]\tvalid_0's multi_logloss: 0.443853\n",
      "[14]\tvalid_0's multi_logloss: 0.417764\n",
      "[15]\tvalid_0's multi_logloss: 0.393613\n",
      "[16]\tvalid_0's multi_logloss: 0.370679\n",
      "[17]\tvalid_0's multi_logloss: 0.349936\n",
      "[18]\tvalid_0's multi_logloss: 0.330669\n",
      "[19]\tvalid_0's multi_logloss: 0.312805\n",
      "[20]\tvalid_0's multi_logloss: 0.296973\n",
      "Did not meet early stopping. Best iteration is:\n",
      "[20]\tvalid_0's multi_logloss: 0.296973\n",
      "Accuracy of lightgbm: 1.0\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAacAAAEWCAYAAADCeVhIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3Xu8VHW9//HXe4MhF5MIRQNhB2pxCxJMO8dDW9NjKN66l8fi5KWbFtoR0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xDguyR3T76LtN+7EhF3kNxeYamk5cC/pS+Vqr9WwTyU3KyT6Igh8ma7i/eczMwsc7znZGZmmeM9JzMzyxyHk5mZZY7DyczMMsfhZGZmmeNwMjOzzPn/IDzS5ZQLUqoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 导入相关模块\n",
    "import lightgbm as lgb\n",
    "from sklearn.metrics import accuracy_score\n",
    "from sklearn.datasets import load_iris\n",
    "from sklearn.model_selection import train_test_split\n",
    "import matplotlib.pyplot as plt\n",
    "# 导入iris数据集\n",
    "iris = load_iris()\n",
    "data = iris.data\n",
    "target = iris.target\n",
    "# 数据集划分\n",
    "X_train, X_test, y_train, y_test = train_test_split(data, target, test_size=0.2, random_state=43)\n",
    "# 创建lightgbm分类模型\n",
    "gbm = lgb.LGBMClassifier(objective='multiclass',\n",
    "                         num_class=3,\n",
    "                         num_leaves=31,\n",
    "                         learning_rate=0.05,\n",
    "                         n_estimators=20)\n",
    "# 模型训练\n",
    "gbm.fit(X_train, y_train, eval_set=[(X_test, y_test)], early_stopping_rounds=5)\n",
    "# 预测测试集\n",
    "y_pred = gbm.predict(X_test, num_iteration=gbm.best_iteration_)\n",
    "# 模型评估\n",
    "print('Accuracy of lightgbm:', accuracy_score(y_test, y_pred))\n",
    "lgb.plot_importance(gbm)\n",
    "plt.show();"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
